/**
 * Created by zhangb on 2015/10/10.
 */

var myform = document.querySelector('form');
//console.log(myform);
myform.addEventListener('click',function(event)
{
    event.stopPropagation();
},true);

var phases = {
    1:'capture',2:'target',3:'bubble'
};
var body = document.querySelector('body');
var div = document.querySelector('div');
var button = document.querySelector('button');

body.addEventListener('click',callback,true);
div.addEventListener('click',callback,true);
button.addEventListener('click',callback,true);

body.addEventListener('click',callback,false);
div.addEventListener('click',callback,false);
button.addEventListener('click',callback,false);

function callback(event)
{
    var tag = event.currentTarget.tagName;
    var phase = phases[event.eventPhase];
    alert("Tag:"+tag+",EventPhase:"+phase);
}